﻿
// IniFile.h: interface for the CIniFile class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_INIFILE_H__D5A2B7FC_6022_4EA2_9E54_91C4E7B31B8E__INCLUDED_)
#define AFX_INIFILE_H__D5A2B7FC_6022_4EA2_9E54_91C4E7B31B8E__INCLUDED_3

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define  KEY_INFO      0x01 //键名信息
#define  VAL_INFO      0x10 //键值信息
#define  ALL_INFO      0x11 //所有信息

class CIniFile
{
public:
	CIniFile();
	virtual ~CIniFile();
	VOID 	SetIniFileName(CString FileName) { IniFileName = FileName; } //设置ＩＮＩ文件名
	CString	GetIniFileName() { return IniFileName; } //获取INI 文件名称
	CString	GetString(CString AppName, CString KeyName, CString Default = _T(""));//获取字符键值
	INT  	GetInt(CString AppName, CString KeyName, INT Default = 0); //获取整形键值
	DOUBLE  GetDouble(CString AppName, CString KeyName, DOUBLE Default = 0);//获取浮点键值
	DWORD	GetDword(CString AppName, CString KeyName, ULONG Default = 0);//获取无符号整形键值

	BOOL	SetString(CString AppName, CString KeyName, CString Data);//设置字符串键值
	BOOL	SetInt(CString AppName, CString KeyName, INT Data);//设置整形键值
	BOOL	SetDouble(CString AppName, CString KeyName, DOUBLE Data);//设置浮点键值
	BOOL	SetDword(CString AppName, CString KeyName, ULONG Data); //设置无符号整形键值

	BOOL    Delete(CString AppName, CString KeyName);

	INT     GetSections(CStringArray& sectionArray); //获取所有节点信息
	INT     GetSectionKeys(CString AppName, CStringArray& KeyArray, UINT nType = ALL_INFO); //获取节点下的指定信息

private:
	CString IniFileName; //文件名
};

#endif // !defined(AFX_INIFILE_H__D5A2B7FC_6022_4EA2_9E54_91C4E7B31B8E__INCLUDED_)
